package com.mxpio.crm.contacts.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mxpio.crm.customer.entity.CrmCustomer;
import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.BaseEntity;
import com.mxpioframework.security.entity.Dept;
import com.mxpioframework.security.entity.User;
import com.mxpioframework.security.service.policy.CreateDeptPolicy;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import java.util.Date;

/**
 * 联系人对象 crm_contacts
 *
 * @author Cheng
 * @date 2022-11-24
 */
@Data
@Entity
@Table(name = "crm_contacts")
@Schema(description = "联系人表")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
public class CrmContacts extends BaseEntity {

    /**
     * id
     */
    @Id
    @Generator
    @Schema(description = "id")
    @Column(name = "id", length = 64)
    private String id;
    /**
     * 联系人名称
     */
    @Schema(description = "联系人名称")
    @Column(name = "name", length = 50)
    private String name;
    /**
     * 下次联系时间
     */
    @Schema(description = "下次联系时间")
    @Column(name = "next_time")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date nextTime;
    /**
     * 联系方式
     */
    @Schema(description = "联系方式")
    @Column(name = "mobile", length = 255)
    private String mobile;
    /**
     * 电话
     */
    @Schema(description = "电话")
    @Column(name = "telephone", length = 255)
    private String telephone;
    /**
     * 电子邮箱
     */
    @Schema(description = "电子邮箱")
    @Column(name = "email", length = 255)
    private String email;
    /**
     * 职务
     */
    @Schema(description = "职务")
    @Column(name = "post", length = 255)
    private String post;
    /**
     * 客户ID
     */
    @Schema(description = "客户ID")
    @Column(name = "customer_id", length = 64)
    @Dict(dicEntity = CrmCustomer.class, dicCode = "id", dicText = "customerName")
    private String customerId;
    /**
     * 地址
     */
    @Schema(description = "地址")
    @Column(name = "address", length = 500)
    private String address;
    /**
     * 备注
     */
    @Schema(description = "备注")
    @Column(name = "remark", length = 500)
    private String remark;
    /**
     * 负责人ID
     */
    @Schema(description = "负责人ID")
    @Column(name = "owner_user_id", length = 64)
    @Dict(dicEntity = User.class, dicCode = "username", dicText = "nickname")
    private String ownerUserId;
    /**
     * 批次
     */
    @Schema(description = "批次")
    @Column(name = "batch_id", length = 64)
    private String batchId;
    /**
     * 客户名称
     */
    @Schema(description = "客户名称")
    @Column(name = "customer_name", length = 255)
    private String customerName;
    /**
     * 客户所属部门
     */
    @Column(name = "customer_dept")
    @Schema(description = "客户所属部门")
    @Dict(dicCode = "deptCode", dicEntity = Dept.class, dicText = "deptName")
    private String customerDept;
    /**
     * 客户年龄
     */
    @Schema(description = "客户年龄")
    @Column(name = "age")
    private Integer age;
    /**
     * 所属公司
     */
    @Schema(description = "所属公司")
    @Column(name = "company")
    private String company;

}
